﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CocoaAni.Net.WebSockets.Server.ArgAdapters.Base;


public abstract class MessageArgAdapter<T> : IMessageArgAdapter
{
    public Type TargetType { get; } = typeof(T);
    public Type? TargetAttributeType { get; } = null!;

    object? IMessageArgAdapter.GetTargetParameter(MessageArgContext argContext)
    {
        return GetTargetArg(argContext);
    }

    public abstract T? GetTargetArg(MessageArgContext argContext);
}

public abstract class MessageArgAdapter<T, TAttr> : IMessageArgAdapter
    where TAttr : Attribute
{
    public Type TargetType { get; } = typeof(T);
    public Type TargetAttributeType { get; } = typeof(TAttr);

    object? IMessageArgAdapter.GetTargetParameter(MessageArgContext argContext)
    {
        return GetTargetParameter(argContext);
    }

    public abstract T? GetTargetParameter(MessageArgContext argContext);
}